{% import '@SyliusUi/Macro/messages.html.twig' as messages %}
{% import '@SyliusUi/Macro/pagination.html.twig' as pagination %}

{{ sonata_block_render_event('sylius.shop.product.index.before_search', {'products': products}) }}

{% include '@SyliusShop/Product/Index/_search.html.twig' %}

{{ sonata_block_render_event('sylius.shop.product.index.after_search', {'products': products}) }}

{% include '@SyliusShop/Product/Index/_pagination.html.twig' %}
{% include '@SyliusShop/Product/Index/_sorting.html.twig' %}

<div class="ui clearing hidden divider"></div>

{{ sonata_block_render_event('sylius.shop.product.index.before_list', {'products': products}) }}

{% if resources.data|length > 0 %}
    <div class="ui three column stackable grid" id="products">
        {% for product in resources.data %}
            <div class="column">
                {% include '@SyliusShop/Product/_box.html.twig' %}
            </div>
        {% endfor %}
    </div>
    <div class="ui hidden divider"></div>

    {{ sonata_block_render_event('sylius.shop.product.index.before_pagination', {'products': products}) }}

    {{ pagination.simple(resources.data) }}
{% else %}
    {{ messages.info('sylius.ui.no_results_to_display') }}
{% endif %}
